__author__ = 'Brandon Corfman'

class Cells:
    """ a one-dimensional list that features array-like indexing. The __repr__ method
    leaves off the first and last cells when printing, leaving those two cells effectively
    invisible unless accessed directly. """
    def __init__(self, num_cells, value):
        self.cellList = [value for _ in range(num_cells)]
        self.numCells = num_cells

    def __repr__(self):
        return str(self.cellList[1:self.numCells-1])

    def __getitem__(self, item):
        return self.cellList[item+1]

    def __setitem__(self, key, value):
        self.cellList[key+1] = value

class Grid:
    """ A two-dimensional list of lists that features array-like indexing and a
    single cell border around the perimeter that can be referenced but is invisible
    when printed via the __repr__ method. """
    def __init__(self, num_rows, num_cols):
        self.cells = [Cells(num_cols + 2, None) for _ in range(num_rows + 2)]
        self.numRows = num_rows + 2

    def __repr__(self):
        return str(self.cells[1:self.numRows-1])
        
    def __getitem__(self, item):
        return self.cells[item+1]



